#ifndef CONFIG_H
#define CONFIG_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <pthread.h>
#include <unistd.h>
#include <stdarg.h>
#include <dirent.h>
#include <getopt.h>
#include <regex.h>
#include <sys/stat.h>
#include <sys/time.h>

///////////////////////////////////////////////////////////
// screen color setting
// front color： F
// blank color： B
// reset：   0
// F    B
// 30  40 black
// 31  41 red
// 32  42 green
// 33  43 yellow
// 34  44 blue
// 35  45 purple
// 36  46 cyan
// 37  47 white
///////////////////////////////////////////////////////////
// Support the c99 language specification
// syntax highlight setting
// keyword     red
// preprocess  red
// comment     gray
// delimiter   blue
// identifier  green
// string      yellow
// constant    cyan
// operator    purple
///////////////////////////////////////////////////////////
enum debug_type{
  NONE = 0,
  INFO = 1,
  DEBUG = 2,
  FATAL = 3
};

#define LOGFILE "highlight.log"

// color setting
#define RED "\033[0;31m"
#define GREEN "\033[0;32m"
#define YELLOW "\033[0;33m"
#define BLUE "\033[0;34m"
#define PURPLE "\033[0;35m"
#define CYAN "\033[0;36m"
#define WHITE "\033[0;37m"
#define GRAY "\033[0;90m"
#define NORMAL_COLOR "\033[0m"

enum symbol_type {
  UNRECOGNIZED = 0,
  KEYWORDS = 1,
  PREPROCESS = 2,
  COMMENT = 3,
  DELIMITER = 4,
  IDENTIFIER = 5,
  OPERATOR = 6,
  CONST_INT = 7,
  CONST_INT_U = 8, 
  CONST_INT_L = 9,
  CONST_INT_UL = 10,
  CONST_INT_LL = 11,
  CONST_INT_ULL = 12,
  CONST_INT_OCTAL = 13,
  CONST_INT_HEX = 14,
  CONST_INT_BIN = 15,
  CONST_FLOAT = 16,
  CONST_FLOAT_EXP = 17,
  CONST_CHAR = 18,
  CONST_SYMBOL = 19,
  CONST_ENUM = 20,
  CONST_BOOL = 21,
  CONST_NULL = 22,
  CONST_STR = 23,
  HEADER = 24,
  FUNCTION = 25,
  BACKSLASH = 26,
  MACRO = 27,
  ERROR = 28,
  FILE_EOF = 29
};

extern const char *keywords[];

extern const char *preprocess[];

extern const char *single_operator[];

extern const char *mult_operator[];

extern const char *delimiter[];

void set_thread_num(int n);

int get_thread_num();

enum debug_type get_debug();

char * get_debug_type(enum debug_type type);

void set_debug(enum debug_type type);

int get_keywords_size();

int get_preprocess_size();

int get_single_operator_size();

int get_delimiter_size();

char* get_symbol_color(enum symbol_type type);

char* get_symbol_html_color(enum symbol_type type, enum symbol_type next_type); 

char* get_symbol_type(enum symbol_type type);

#endif